<template>
  <div class="m-content">
    <h3>{{ user.username }}</h3>
    <div class="block">
      <el-avatar :size="100" :src="user.avatar"></el-avatar>
    </div>
    <div class="block">
      <el-row>
        <el-col :span="24">
          <h3 class="item">{{user.userName}}</h3>
<!--          <span class="item">文章:90</span>-->
<!--          <span class="item">专栏:5</span>-->
<!--          <span class="item">关注:200</span>-->
<!--          <span class="item">获赞:500</span>-->
        </el-col>
<!--        <el-col :span="6" :offset="6">-->
<!--           <el-button  type="primary" icon="el-icon-star-off" round>关注</el-button>-->
<!--        </el-col>-->
      </el-row>
    </div>
  </div>
</template>
<script>
  export default {
    name: "Header",
    data() {
      return {
        user: {},
        hasLogin: true
      }
    },
    methods: {
      getAuthor(){
        const _this = this
        this.$request({
          url: '/user/detail',
          method: 'post',
          params:{
            userId:this.$route.query.userId
          }
        }).then(res => {
          if(res.code === 200){
            _this.user = res.data
          }
        })
      },
    },
    created() {
      this.getAuthor();
      // if(this.$store.getters.getUser) {
      //   this.user.username = this.$store.getters.getUser.username
      //   this.user.avatar = this.$store.getters.getUser.avatar
      //   this.user.id = this.$store.getters.getUser.id
      //   this.hasLogin = true
      // }
    }
  }
</script>

<style scoped>
  .m-content {
    padding: 20px 20px;
    max-width: 960px;
    margin: 0 auto;
    text-align: center;
    background-color: #D3DCE6;
  }
  .item{
    margin: 0 10px;
  }
</style>
